from likeshop_api_project.api.login_api import login_model
from likeshop_api_project.base.myBase import Tools


class adddz_model(Tools):
    path = '/api/user_address/add'

    def adddz_action(self, contact, telephone, province_id, city_id, district_id, address, is_default, hd):
        mydata = {
            "contact": contact,
            "telephone": telephone,
            "province_id": province_id,
            "city_id": city_id,
            "district_id": district_id,
            "address": address,
            "is_default": is_default
        }
        print(self.hosturl + self.path)
        res = self.huihua.post(url=self.hosturl + self.path, data=mydata, headers=hd)
        return res.json()


# import requests
#
# s = requests.session()
# login = login_model(huihua=s)
# msg = login.login_action(account='17612345678', pwd='admin123', client='4')
# print(msg)
# tokena = msg['data']['token']
# hd = {
#     'token': tokena
# }
# print(hd)
# adddz = adddz_model(huihua=s)
#
# msg2 = adddz.adddz_action(contact="das", telephone=13212345678, province_id=4, city_id=4, district_id=4, address=1, is_default=1, hd=hd)
# print(msg2)
